<!DOCTYPE html>
<html>
	<head>
		    <meta charset="utf-8">
    <title>Slick Admin</title>
    <meta name="author" content="John">
    <meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport">
    <meta name="description" content="Slick Admin Admin UI">
    <meta name="keywords" content="Slick Admin, Admin UI, Admin Dashboard, John">
    
    <script src="js/html5-trunk.js"></script>
    
    <link href="css/style.css" rel="stylesheet">
    <!--[if lte IE 7]>
    <script src="css/icomoon-font/lte-ie7.js"></script>
    <![endif]-->

    <!-- bootstrap css -->
    <link href="css/bootstrap.css" rel="stylesheet">

    <!-- custom css -->
    <link href="css/main.css" rel="stylesheet">
        <link rel="stylesheet" href="http://localhost:8080/static/login/css/simpleAlert.css">
    <!-- wysiwyg css -->
    <link href="css/wysiwyg/bootstrap-wysihtml5.css" rel="stylesheet">
    <link href="css/wysiwyg/wysiwyg-color.css" rel="stylesheet">
    <script type="text/javascript" src="/static/fm/jquery/jquery-1.7.2.min.js"></script>
    <script src="js/matrix.login.js"></script>
    <script src="/static/login/js/jquery.min.js"></script>
    <script src="/static/login/js/simpleAlert.js"></script>

	</head>
    <body>
    <div class="dashboard-wrapper">        <!-- Row Start -->
        <div class="row">
          <div class="col-md-12">
            <div class="widget">
              <div class="widget-header">
                <div class="title">
                  <span class="fs1" aria-hidden="true" data-icon="&#xe14c;"></span> 发布 &amp; 公告
                </div>
              </div>
              <div class="widget-body">
                <div class="form-group">
                  <label class="control-label" for="inputDefault">主标题</label>
                  <input type="text" id="title1" class="form-control" id="inputDefault" placeholder="主标题">
                </div>
               <!--   <div class="form-group">
                      <label class="control-label" for="inputDefault">副标题</label>
                      <input type="text" id="title2" class="form-control" id="inputDefault1" placeholder="副标题">
                  </div>-->
                <!--<div class="form-group">
                  <label for="inputHelptext">Input help text</label>
                  <input type="text" id="inputHelptext" class="form-control" placeholder="Input Helptext">
                  <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
                </div>-->
                <div class="form-group">
                  <label >Textarea</label>
                  <textarea id="text1" class="form-control" rows="12"></textarea>
                </div>
                   
                      <span class="input-group-btn" >
                        <button class="btn btn-default" id="textsub" onclick="textsub1()">提交!</button>
                          <!--<button onclick="copyText()">复制文本</button>-->
                      </span>
                   
                </div>
                
              </div>
            </div>
          </div>
        </div>
        </div>
        <!-- Row end -->
<script>
    function textsub1() {
        alert("你好");
        console.info("你好");
        var gonghao=$("#title1").val();
       /* var youxianghao=$("#title2").val();*/
        var yanzheng=$("#text1").val();
        alert(gonghao+yanzheng);
        var adminUser=localStorage.getItem("key");
        alert("用户"+adminUser);
        $.ajax({
            type: "post",
            url: "http://localhost:8080/adminShower/insertContent",
            data: {"title1":$("#title1").val(), "text1":$("#text1").val(),"adminUser":adminUser},
            dataType: "json",
            success: function(data,statusTxt,xhr){
                if(statusTxt=="success"){

                    if(data.code=="F_99999"){
                        var dblChoseAlert = simpleAlert({
                            "content":"添加失败,相同标题只能插入一次!",
                            "buttons":{
                                "确定":function () {

                                    dblChoseAlert.close();
                                }
                            }
                        })
                    }else{
                        alert("1111"+$("#title1").val());
                        var dblChoseAlert = simpleAlert({
                            "content":"添加成功!",
                            "buttons":{
                                "确定":function () {

                                    dblChoseAlert.close();
                                }
                            }
                        })
                    }


                }else{

                    var dblChoseAlert = simpleAlert({
                        "content":"添加失败,请检查!",
                        "buttons":{
                            "确定":function () {

                                dblChoseAlert.close();
                            }
                        }
                    })
                }
            },
            error:function(xhr,textStatus){
                var dblChoseAlert = simpleAlert({
                    "content":"添加失败，网络原因!",
                    "buttons":{
                        "确定":function () {

                            dblChoseAlert.close();
                        }
                    }
                })
                console.log('错误')
                console.log(xhr)
                console.log(textStatus)
            },
            complete:function(){
                console.log('结束')
            }
        });
    };

</script>

		
	</body>
</html>
